<?php
session_start();
//检测是否已登入
if(!empty($_SESSION['admin'])){
    header("location:./index.php");
}
if ($_POST['user']&&$_POST['pass']){
    include '../model/db.php';
    $sql="select id,user,pass,ip,time from bl_user where user='{$_POST['user']}'";
//    var_dump($sql);exit;
    $arr=db_sel($sql);
    if(empty($arr)){
        exit("<script>alert('用户名不存在');location.href='./login.php'</script>");
    }
    if($arr['pass']!=$_POST['pass']){
        exit("<script>alert('密码错误');location.href='./login.php'</script>");
    }
    $_SESSION['admin']=$arr;
    $sql="update bl_user set ip='{$_SERVER['REMOTE_ADDR']}',time='".time()."' where id = '{$arr['id']}'";
    $a=db_query($sql);

    exit("<script>alert('登入成功');location.href='./index.php'</script>");
}
?>

<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<title>程序员博客登录</title>

<link href="../public/admin/styles/lostyle.css" rel="stylesheet" type="text/css">
<!--<script type="text/javascript" src="../../public/Admin/login/jquery-1.8.3.min.js.下载"></script>-->
</head>
<body>

<div class="videozz"></div>
	<video autoplay="" muted="" loop="" poster="assets/images/fallba1ck.jpg">
		<source src="../public/admin/images/mov.mp4">
		你的游览器不支持video支持
	</video>
<div class="box">
	<div class="box-a">
    <div class="m-2">
          <div class="m-2-1">
                <form action="login.php" method="post">
                    <div class="m-2-2">
                       <input type="text" placeholder="请输入账号" name="user">
                    </div>
                    <div class="m-2-2">
                       <input type="password" placeholder="请输入密码" name="pass">
                    </div>
                    <!--<div class="m-2-2-1">-->
                       <!--<input type="text" placeholder="请输入验证码">-->
                       <!--<img src="../../public/Admin/login/1.png">-->
                    <!--</div>-->
                    <div class="m-2-2">
                       <button type="submit" value="登陆">
                         登陆
                       </button>
                    </div>    
                </form>
          </div>
    </div>

    <div class="m-5"> 
    <div id="m-5-id-1"> 
    <div id="m-5-2"> 
    <div id="m-5-id-2">  
    </div> 
    <div id="m-5-id-3"></div> 
    </div> 
    </div> 
    </div>   
    <div class="m-10"></div>
    <div class="m-xz7"></div>
    <div class="m-xz8 xzleft"></div>
    <div class="m-xz9"></div>
    <div class="m-xz9-1"></div>
    
    <div class="m-x17 xzleft"></div>
    <div class="m-x18"></div>
    <div class="m-x19 xzleft"></div>
    <div class="m-x20"></div>  
    <div class="m-8"></div>
    <div class="m-9"><div class="masked1" id="sx8">IT博客后台</div></div> 
    <div class="m-11">
    	<div class="m-k-1"><div class="t1"></div></div>
        <div class="m-k-2"><div class="t2"></div></div>
        <div class="m-k-3"><div class="t3"></div></div>
        <div class="m-k-4"><div class="t4"></div></div>
        <div class="m-k-5"><div class="t5"></div></div>
        <div class="m-k-6"><div class="t6"></div></div>
        <div class="m-k-7"><div class="t7"></div></div>
    </div>   
    <div class="m-14"><div class="ss"></div></div>
    <div class="m-15-a">
    <div class="m-15-k">
    	<div class="m-15xz1">
            <div class="m-15-dd2"></div>
        </div>
    </div>
    </div>
    <div class="m-16"></div>
    <div class="m-17"></div>
    <div class="m-18 xzleft"></div>
    <div class="m-19"></div>
    <div class="m-20 xzleft"></div>
    <div class="m-21"></div>
    <div class="m-22"></div>
    <div class="m-23 xzleft"></div>
    <div class="m-24" id="localtime"></div>
    </div>
</div>
<!--<script src="../../public/Admin/login/common.min.js.下载"></script>-->


</body></html>